package com.yogee.topseller.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.yogee.core.base.BaseRecyclerAdapter;
import com.yogee.topseller.R;
import com.yogee.topseller.bean.SelectCommissionBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @auathor ${XiaoJianghong}
 * @date 2017/6/22.
 */

public class YJLSRvAdapter extends BaseRecyclerAdapter<SelectCommissionBean.CommListBean> {
    
    public YJLSRvAdapter(Context context, List<SelectCommissionBean.CommListBean> list) {
        super(context, list);
    }

    @Override
    protected int getLayout() {
        return R.layout.item_yjls;
    }

    @Override
    protected void bingView(RecyclerView.ViewHolder holder, SelectCommissionBean.CommListBean data, int pos) {
        if (holder instanceof ViewHolder){
            ((ViewHolder) holder).itemYjlsDateTv.setText(data.getCreateDate());
            ((ViewHolder) holder).itemYjlsMoneyTv.setText(data.getMoney());
            ((ViewHolder) holder).itemYjlsNameTv.setText(data.getTitle());
            if(TextUtils.isEmpty(data.getProType()))
                ((ViewHolder) holder).item_yjls_type_tv.setVisibility(View.GONE);
            else
                ((ViewHolder) holder).item_yjls_type_tv.setVisibility(View.VISIBLE);
            ((ViewHolder) holder).item_yjls_type_tv.setText(data.getProType());

        }
    }

    @Override
    protected RecyclerView.ViewHolder createViewHolder(View layout) {
        return new ViewHolder(layout);
    }

    protected class ViewHolder extends Holder {
        @BindView(R.id.item_yjls_name_tv)
        TextView itemYjlsNameTv;
        @BindView(R.id.item_yjls_date_tv)
        TextView itemYjlsDateTv;
        @BindView(R.id.item_yjls_money_tv)
        TextView itemYjlsMoneyTv;
        @BindView(R.id.item_yjls_type_tv)
        TextView item_yjls_type_tv;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
